<?php 
session_cache_expire(999999999);
if(!isset($_SESSION)) 
{ 
	session_start(); 
}
$lang = $_SESSION['lang'];
if (empty($lang) || $lang == "EN") {
	include "../value/value_en.php";
} else if($lang == "VN") {
	include "../value/value_vn.php";
}
else {
	include "../value/value_kr.php";
}
include '../operations/connection.php';	


$typeAssets=$_REQUEST['typeAssets'];



$idgroupAssets=0;

$result=mysql_query("SELECT COUNT(*) as count FROM assets a WHERE a.type='".$typeAssets."';");

$r=mysql_fetch_array($result);
$kq=0;
if($r['count']==0){
	mysql_query("DELETE FROM `type_assets` WHERE (`id`='".$typeAssets."')");
	$kq=0;
}else{
	$kq= 1;
}

$type_assets=mysql_query("SELECT t.*,(SELECT COUNT(*) FROM assets a WHERE a.type=t.id ) as count FROM type_assets t ORDER BY t.name;");
$typeassets=array();
while ($r = mysql_fetch_array($type_assets)){
		$typeassets[]=array($r['id'],$r['name'],$r['count']);
}

mysql_close($connection);
?>

<td  class="tdfirst"><?php echo $l_typeassets;?></td>
								<td style="width: 100px">
								<input type="hidden" id="kqtypeAssets" value="<?php echo $kq;?>" />
								<select name="typeAssets" id="typeAssets" style="font-size: 12px;height: 28px; width: 190px;padding: 4px;">
								<?php 
									$i=0;
									foreach ($typeassets as $value => $giatri)
									{
										?>
									<option value="<?php echo $giatri[0];?>" <?php if(isset($_SESSION['typeAssets']) && $_SESSION['typeAssets']==$giatri[1]){echo 'selected="selected"'; unset($_SESSION['typeAssets']);}?>><?php echo $giatri[1];?></option>
									<?php 
										$i++;
									}
														
									?>
								</select>
									<!-- <div style="float:left">
											<input type="text" size="30" name="typeAssets" id="typeAssets" value="<?php /*echo $typeassets[0][1];*/?>" onkeypress="return enterTable(event,this.id,'0')"  style="width: 185px;height: 24px; border: 1px solid #c4c0c9;font-size: 12px;line-height: 24px;" autocomplete="off" />
											
											<div class="suggestionsBox" id="suggestions" style="display:none;">
												<img src="images/upArrow.png" style="position: relative; top: -12px; left: 30px;" alt="upArrow" />
												<div class="suggestionList" id="autoSuggestionsList">
													&nbsp;
												</div>
											</div> 						
											</div>
											<div style=" float:left; position:relative; margin-top: 5px; margin-left: -21px">
												<img alt="" src="images/arrow-down.png" id="menu_expand1" onkeypress="return enterTable(event,this.id,'0')" >
											    <div id="content_menu_expand1" class="passul content_menu_expand" style="display:none">
											        <ul>
											        <?php 
											        
											    		
														$i=0;
														foreach ($typeassets as $value => $giatri)
														{
															?>
															<li onmouseover="this.style.cursor='pointer'"  onmouseout="this.style.cursor='default'" onclick="clickCustomer1('<?=$giatri[1]?>')" 
																<?php 
																	if($i%2!=0){
																		?>
																		class="bgkhac"
																		<?php 
																	}
																?>
															> <?php echo $giatri[1];?></li>
															<?php 
															$i++;
														}
														
											    	?>
											        </ul>
											    </div>
											</div>	 -->
								
									
								</td>
								<td>
								<?php if(count($typeassets)){?>
									<a style="padding-left: 5px;" onclick="showdeltypeAssets()"><img src="images/del.png"  title="<?php echo $l_deltypeassets;?>" /></a>
									<a style="padding-left: 5px;" onclick="showedittypeassets()"><img src="images/editn.png"  title="<?php echo $l_edittypeassets;?>" /></a>
								<?php }?>
									<a style="padding-left: 5px;" onclick="popup_window_show('#sample2', { pos : 'window-center', width : '320px', height:'800px'});"><img src="images/plus.png"  title="<?php echo $l_addtypeassets;?>" /></a>
								</td>